package com.oracle.sbdb.testdao;

import java.sql.Date;

import org.junit.Test;

import com.oracle.sbdb.dao.UpdatesDao;
import com.oracle.sbdb.model.Updates;

public class UpdatesDaoTest {

	@Test
	public void test() {
		Updates updates = new Updates();
		int bugId = 2;
		updates.setBug_id(bugId);
		updates.setUpdate_engineer_id(25160);
		updates.setUpdate_hiden(true);
		updates.setUpdate_time(new Date(System.currentTimeMillis()));
		updates.setUpdate_content("The first updates for bug" + bugId);
		UpdatesDao dao = new UpdatesDao();
		dao.insert(updates);

		try {
			Thread.sleep(1000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		updates.setUpdate_content("The second updates for bug" + bugId);
		dao.insert(updates);
		
		try {
			Thread.sleep(1000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		updates.setUpdate_content("The third updates for bug" + bugId);
		dao.insert(updates);
		
		try {
			Thread.sleep(1000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		updates.setUpdate_content("The fourth updates for bug" + bugId);
		dao.insert(updates);
	}
	
//	@Test
	public void testSelectbyEmployeeId() {
		UpdatesDao dao = new UpdatesDao();
		System.out.println(dao.selectbyBugId(1).size());
	}
}
